<?
session_start();
require_once('config.php');
require_once('class/cls_product.php');

$product			= new cls_product();;
$product_id = $_REQUEST['id'];
if($product_id != "" || $product_id != null){
	$product->delete_product_list($product_id);
}
?>
<html>
<head>
<title>Admin</title> 
<link href="../soethida/um_sty.css" rel="stylesheet" type="text/css">
<script language="javascript">
function deletefun(id){
	window.location ="products.php?id="+id;
}
</script>
</head>

<body leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0" bgcolor="#F7F9F0">
<table id="Table_01" width="775" height="32" align="center" border="0" cellpadding="0" cellspacing="0">

	<tr>

		<td width="233" height="32"><img src="images/banner.jpg" width="777" height="100" alt=""></td>

	</tr>
</table>  
<table id="Table_02" width="775" height="24" align="center" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0">

	<tr>

		<td width="544" align="left" valign="middle">

		&nbsp;&nbsp;&nbsp;<a  href="index.php" class="ummenu" >Home</a>		

	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		
		<a href="customer_service.php" class="ummenu">Customer Services</a>
		
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		<a href="contact_us.php" class="ummenu">Contact Us</a>
		
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		<a href="aboutus.php" class="ummenu">About Us</a>


		

		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

		<td width="231" height="24" align="right" valign="middle"><a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_ja&trurl=http%3a%2f%2fwww.umgroups.com">

		</a>&nbsp;&nbsp;

		<a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_zt&trurl=http%3a%2f%2fwww.umgroups.com">		</a>&nbsp;&nbsp;

		<a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_ko&trurl=http%3a%2f%2fwww.umgroups.com">		</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>

	</tr>

</table>
<table id="Table_01" width="775" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC" >
		 <tr>
          <td>
   	
		  
		<table align="center" border="0" cellpadding="0" cellspacing="0" width="775" id="table6" bgcolor="#FFFFFF" style="border-bottom: 3px solid #DF8A0B;">


			<tr>

				<td height="30" colspan="2" class="foot">&nbsp;</td>
			</tr>

			
			<tr>

				<td class="copy" style="padding-left: 3px" colspan="2">&nbsp;</td>
			</tr>
            <tr>
            	<td>
                	<table border="1" width="100%">
                    	<tr><td colspan="8">
                        <form name="productlist" action="product_update.php" method="post">
                        <input type="submit" name="cmd" value="Add Product" ></td></tr>
                    	<tr>
                        	<th>No</th>
                            <th>Type</th>
                            <th>Brand</th>
                            <th>Price</th>
                            <th>Rate</th>
							<th>Rate Count</th>
                            <th>Status</th>
                            <th>Action</th>
                          </tr>
                          <?php
						  $object =$product->getproductall();
						//  $strsql = "select * from tbl_product";
						//  $result = mysql_query($strsql) or die("Could not access");
						  $i = 1;
						 foreach ($object as $row){
							  echo "<tr>";
							  echo "<td>".$i++."</td>";
							  echo "<td>".$product->gettypename($row['coordinator_id'])."</td>";
							  echo  "<td>".$row['brand']."</td>";
							   echo  "<td>".$row['price']."</td>";
							  echo  "<td>".$row['rate']."</td>";
							  echo "<td>".$row['ratecount']."</td>";
							   echo "<td>".$row['status']."&nbsp;</td>";
							  echo "<td><a href='#' onclick='deletefun(\"".$row['product_id']."\");'>Delete</a></td>";
						  }
						  ?></table>
                    </table>
                </td>
            </tr>
		</table>
		</td></tr></table>

</body>
</html>

<?php

function gettypename($co_id){
	$strsql = "select coordinator_name from coordinator where coordinator_id='$co_id'";
	$result = mysql_query($strsql);
	$row = mysql_fetch_assoc($result);
	$co_name = $row['coordinator_name'];
}
?>
